<?php
 
	function smarty_block_stop_ships($params, $content, &$smarty, &$repeat) {

		global $db, $config;

		$l = count($smarty->_tag_stack);
		if(empty($params['name'])) $params['name'] = "stop_ships";
        
		if(empty($smarty->blockvars[$l])) {

			$results = stop_ship::search($params);
			$smarty->blockvars[$l] = isset($results['results']) ? $results['results'] : null;
			$pager = isset($results['pager']) ? $results['pager'] : null;

			if(!$smarty->blockvars[$l]) return $repeat = false;
			if(!empty($params['pager'])) $smarty->assign($params['pager'], $pager);
		}
		if(list($key, $item) = each($smarty->blockvars[$l])) {
			$repeat = true;
			$item = stop_ship::setupStopShips($item);
			$smarty->assign($params['name'], $item);
		}
		else {
			$repeat = false;
			reset($smarty->blockvars[$l]);
		}
		
		if(!is_null($content)) print $content;
	
		//
		if(!$repeat) $smarty->blockvars[$l] = array();
	}